<%-- 
    Document   : listUsuarios
    Created on : 27/08/2013, 08:39:17
    Author     : 0731110
--%>

<%@page import="model.Agenda"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>        
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
        <link href="css/style.css" rel="stylesheet" type="text/css" />
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <script type="text/javascript" src="js/bootstrap.min.js"></script>
        <title>Clínica Médica - Sua saúde em primeiro lugar</title>        
    </head>
    <body>        
        <div class="container">
            <jsp:include page="cabecalho.jsp" flush="true" />       
            <div class="content">
                <div class="panel panel-default espaco-form">
                    <div class="row">
                        <div class="col-md-10">
                            <h3>Pesquisar Agendas</h3>
                        </div>
                        <div class="col-md-2">
                            <a class="btn btn-success pull-right espaco-botao" href="javascript:history.back(1)" title="Voltar">Voltar</a>                    
                        </div>                        
                    </div>
                    <p>Aqui você visualiza as agendas cadastradas.</p>        
                    <div class="table-responsive espaco-table">
                        <table class="table table-bordered table-striped table-hover">
                            <thead>
                                <tr>
                                    <th>Agenda</th>
                                    <th>Profissional</th>
                                    <th>Editar</th>
                                    <th>Excluir</th>
                                </tr>
                            </thead>
                           <tbody>
                                <% ArrayList lista = (ArrayList) session.getAttribute("listaPesquisarAgenda");
                                Iterator it = lista.iterator();
                                while (it.hasNext()) {
                                Agenda agen = (Agenda) it.next();
                                int idAgenda = agen.getIdAgenda();
                                String nome = agen.getProfissional().getPessoa().getNome();
                                %>
                                <tr> 
                                    <td><%=idAgenda%></td>
                                    <td><%=nome%></td>
                                    <td>
                                        <form method="POST" action='FrontController'>
                                            <input type="image" class="img-tam-menor" src="img/editar.png" alt="Editar" title="Editar" name="editar">
                                            <input type="hidden" name="idEditar" value="<%=agen.getIdAgenda()%>">
                                            <input type="hidden" name="servlet" value='EditarAgenda'>
                                        </form>
                                    </td>
                                    <td> 
                                        <form method="POST" action="FrontController">
                                            <input type="image" class="img-tam-menor" src="img/deletar.png" alt="Excluir" title="Excluir" name="excluir">
                                            <input type="hidden" name="servlet" value="ExcluirAgenda">
                                            <input type="hidden" name="idExcluir" value="<%=agen.getIdAgenda()%>">
                                        </form>
                                    </td>    
                                </tr>
                                <% } // Fecha o while%>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>  
            <jsp:include page="rodape.jsp" flush="true" />
        </div>        
    </body>
</html>